package com.course02.order_backend.dto.LXY;

import lombok.Data;

/**
 * 统一后端向前端返回统一的约束格式
 * @author wozhe*
 */
/**
 * 统一返回值
 */
@Data
public class Result {
    /**
     * 响应状态码
     */
    private int code=200;
    /**
     * 响应提示消息
     */
    private String msg="成功";
    /**
     * 响应结果
     */
    private Object data;

    public static Result ok(){
        return new Result();
    }
    public static Result ok(Object data){
        return new Result(data);
    }
    public static Result error(String msg){
        return new Result(msg);
    }
    public Result() {
    }
    public Result(Object data) {
        this.data = data;
    }
    public Result(String msg) {
        this.code = -1;
        this.msg = msg;
    }
    public Result(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
